home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / Libraries / Dots & Pixels / sources / depthChange.cp < prev    next >
Text File  |  1995-09-29  |  524b  |  32 lines

  1. #include <Palettes.h>
  2.  
  3. #include "depthChange.h"
  4.  
  5. depthChange::depthChange() : oldDepth( 0)
  6. {
  7.     theGDHandle = 0;
  8. }
  9.  
  10. depthChange::depthChange( int newDepth, GDHandle aGDHandle)
  11.     : oldDepth( (**(**aGDHandle).gdPMap).pixelSize)
  12. {    
  13.     if( newDepth == oldDepth)
  14.     {
  15.         theGDHandle = 0;
  16.     } else {
  17.         theGDHandle = aGDHandle;
  18.     }
  19.     if( SetDepth( aGDHandle, newDepth, 0x0001, 0x0001) != noErr)
  20.     {
  21.         theGDHandle = 0;
  22.     }
  23. }
  24.  
  25. depthChange::~depthChange()
  26. {
  27.     if( theGDHandle != 0)
  28.     {
  29.         (void)SetDepth( theGDHandle, oldDepth, 0x0001, 0x0001);
  30.     }
  31. }
  32.